import Vue from 'vue'
//导入v-md-edit 插件
import VMdEditor from '@kangc/v-md-editor/lib/codemirror-editor';
//导入v-md-edit 插件样式
import '@kangc/v-md-editor/lib/style/codemirror-editor.css';
//导入代码高亮模式，为github模式
import githubTheme from '@kangc/v-md-editor/lib/theme/github.js';
//导入代码高亮样式
import '@kangc/v-md-editor/lib/theme/style/github.css';
//导入highlightjs
import hljs from 'highlight.js';
import VueMarkdownEditor from '@kangc/v-md-editor/lib/codemirror-editor';
import createKatexPlugin from '@kangc/v-md-editor/lib/plugins/katex/cdn';
// codemirror 编辑器的相关资源【进阶版】
import Codemirror from 'codemirror';
// mode
import 'codemirror/mode/markdown/markdown';
import 'codemirror/mode/javascript/javascript';
import 'codemirror/mode/css/css';
import 'codemirror/mode/htmlmixed/htmlmixed';
import 'codemirror/mode/vue/vue';
// edit
import 'codemirror/addon/edit/closebrackets';
import 'codemirror/addon/edit/closetag';
import 'codemirror/addon/edit/matchbrackets';
// placeholder
import 'codemirror/addon/display/placeholder';
// active-line
import 'codemirror/addon/selection/active-line';
// scrollbar
import 'codemirror/addon/scroll/simplescrollbars';
import 'codemirror/addon/scroll/simplescrollbars.css';
// style
import 'codemirror/lib/codemirror.css';


// 预览组件
import VMdPreview from '@kangc/v-md-editor/lib/preview';
import '@kangc/v-md-editor/lib/style/preview.css';



VMdEditor.Codemirror = Codemirror;

VueMarkdownEditor.use(createKatexPlugin());


//配置v-md-edit插件的代码高亮为github模式，使用highlight.js
VMdEditor.use(githubTheme, {
  Hljs: hljs,
});
VMdPreview.use(githubTheme, {
  Hljs: hljs,
});

//全局使用 v-md-edit 插件
Vue.use(VMdEditor);
Vue.use(VMdPreview);